<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Cache-Control" content="no-siteapp">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=1, minimum-scale=1, maximum-scale=1">
<meta name="renderer" content="webkit">
<meta name="google" value="notranslate">
<meta name="robots" content="index,follow">


<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="足迹">
<meta name="twitter:description" content="走过就要留下点什么">
<meta name="twitter:image:src" content="http://wenjq.gitee.io/images/avatar.jpg">

<meta property="og:url" content="http://wenjq.gitee.io">
<meta property="og:title" content="足迹">
<meta property="og:description" content="走过就要留下点什么">
<meta property="og:site_name" content="足迹">
<meta property="og:image" content="http://wenjq.gitee.io/images/avatar.jpg">
<meta property="og:type" content="website">
<meta name="robots" content="noodp">

<meta itemprop="name" content="足迹">
<meta itemprop="description" content="走过就要留下点什么">
<meta itemprop="image" content="http://wenjq.gitee.io/images/avatar.jpg">

<link rel="canonical" href="http://wenjq.gitee.io">

<link rel="shortcut icon" href="/favicon.png">
<link rel="apple-itouch-icon" href="/favicon.png">
<link rel="stylesheet" href="/bundle/index.css">
<script type="text/javascript">
    var timeSinceLang = {
        year: '年前',
        month: '个月前',
        day: '天前',
        hour: '小时前',
        minute: '分钟前',
        second: '秒前'
    };
    var root = '';
</script>


        <meta name="keywords" content="saiku,">
        <meta name="description" content="saiku3.15整合（非maven）">
        <meta name="author" content="">
        <title>saiku3.15整合（非maven）</title>
    </head>
    <body>
        <article class="container">
            <header class="header-wrap">
  <a class="index" href="/">
    <img class="logo" src="/images/avatar.jpg" />
    足迹
  </a>
  <ul class="menu">
      <li class="menu-item"><a href="/archive.html">归档</a></li>
      <li class="menu-item"><a href="/tag.html">标签</a></li>
      <li class="menu-item"><a href="/atom.xml">订阅</a></li>
  </ul>
</header>

            <article class="main article">
                <h1 class="title">saiku3.15整合（非maven）</h1>
                <section class="info">
                    
                    
                    
                    <span class="date" data-time="1527386400"><span class="from"></span></span>
                    
                    <span class="tags"><a class="tag" href="/tag/saiku/index.html">saiku</a></span>
                </section>
                <article class="content"><h2>整合代码</h2>

<p>尝试直接用saiku源码进行编译时，大量的jar无法下载，因此决定直接使用非maven的方式。</p>

<h5>下载saiku</h5>

<p>下载saiku最新的发布包和源码（<a href="https://community.meteorite.bi/">https://community.meteorite.bi/</a> ），为了方便jar包的对应，这里保持发布包和源码的版本一致，目前最新的是3.15。</p>

<h5>创建项目</h5>

<ol>
<li>使用eclipse创建web项目
创建Dynamic Web Project，主要项目名称必须为saiku，因为saiku-web中请求地址均为http://&hellip;/saiku/&hellip;。完成后项目结构如图:</li>
</ol>

<p><img src="" data-src="/images/20180527_01.png" alt="纸小墨 - 简洁的静态博客构建工具" /></p>

<ol>
<li>分别创建sources文件夹</li>
</ol>

<p><img src="" data-src="/images/20180527_02.png" alt="" /></p>

<ol>
<li>拷贝代码

<ul>
<li>找到源码路径/saiku-core/,分别吧相同文件夹下的 src/main/java/路径下的代码到新建的项目文件夹下。
<img src="" data-src="/images/20180527_03.png" alt="" /></li>
<li>拷贝源码路径/saiku-webapp/src/main/webapp/ 下的所有文件到新项目WebContent下（覆盖）。</li>
<li>拷贝发布包/saiku-latest/saiku-server/tomcat/webapps/ROOT/ 下的所有文件到新项目WebContent下。</li>
<li>拷贝发布包/saiku-latest/saiku-server 下的data与repository文件夹到新项目WebContent下。
<img src="" data-src="/images/20180527_04.png" alt="" /></li>
</ul></li>

<li><p>导入jar包
拷贝发布包/saiku-latest/saiku-server/tomcat/webapps/saiku/WEB-INF/lib/ 下所有的jar包到新项目WebContent/WEB-INF/lib/ 下。
<img src="" data-src="/images/20180527_05.png" alt="" /></p>

<h5>修改错误</h5>

<p>完成代码拷贝后，saiku-service/org/saiku/olap/query2/util/Fat.java报错的话，直接将报错的行注掉。
<img src="" data-src="/images/20180527_06.png" alt="" /></p>

<h5>修改tomcat工作路径</h5></li>

<li><p>打开tomcat配置页
<img src="" data-src="/images/20180527_07.png" alt="" /></p></li>

<li><p>选择Arguments，修改Working directory路径为 tomcat\bin
<img src="" data-src="/images/20180527_08.png" alt="" /></p>

<h2>去除License和欢迎页</h2>

<h5>去除license</h5></li>

<li><p>修改 org/saiku/web/service/SessionService.java的login</p></li>
</ol>

<pre><code class="language-java">    public Map&lt;String, Object&gt; login(HttpServletRequest req, String username, String password ) throws LicenseException {
    //      Object sl = null;
    //      String notice = null;
            HttpSession session = ((HttpServletRequest)req).getSession(true);
            session.getId();
            sessionRepo.setSession(session);

    //      try {
    //          sl = l.getLicense();
    //      } catch (Exception e) {
    //          log.debug(&quot;Could not process license&quot;, e);
    //          throw new LicenseException(&quot;Error fetching license. Get a free license from http://licensing.meteorite.bi. You can upload it at /upload.html&quot;);
    //      }

    //      if (sl != null) {
            if (true) {

    //          try {
    //              l.validateLicense();
    //          } catch (RepositoryException | IOException | ClassNotFoundException e) {
    //              log.debug(&quot;Repository Exception, couldn't get license&quot;, e);
    //              throw new LicenseException(&quot;Error fetching license. Please check your logs.&quot;);
    //          }

                //              if (l.getLicense() instanceof SaikuLicense2) {
                if (true) {
                    if (authenticationManager != null) {
                        authenticate(req, username, password);
                    }
                    if (SecurityContextHolder.getContext() != null
                        &amp;&amp; SecurityContextHolder.getContext().getAuthentication() != null) {
                        Authentication auth = SecurityContextHolder.getContext().getAuthentication();

                        if (authorisationPredicate.isAuthorised(auth)) {
                            Object p = auth.getPrincipal();
                            createSession(auth, username, password);
                            return sessionHolder.get(p);
                        } else {
                            log.info(username + &quot; failed authorisation. Rejecting login&quot;);
                            throw new RuntimeException(&quot;Authorisation failed for: &quot; + username);
                        }
                    }
                    return new HashMap&lt;&gt;();
                }
            }
            return null;
        }
</code></pre>

<ul>
<li>修改org/saiku/web/rest/resources/License.java</li>
</ul>

<pre><code class="language-java">public Response getLicense() {
//    try {
//      return Response.ok().entity(licenseUtils.getLicense()).build();
//    } catch (IOException | RepositoryException | ClassNotFoundException e) {
//      e.printStackTrace();
//    }
//    return Response.serverError().build();
      return Response.ok().build();
}
public Response validateLicense() {
//    if(!userService.isAdmin()){
//      return Response.status(Response.Status.FORBIDDEN).build();
//    }
//    try {
//      licenseUtils.validateLicense();
//    } catch (IOException e) {
//      e.printStackTrace();
//      return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
//                     .entity(e.getLocalizedMessage()).build();
//    } catch (ClassNotFoundException e) {
//      e.printStackTrace();
//      return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
//                     .entity(e.getLocalizedMessage()).build();
//    } catch (LicenseException e) {
//      return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
//                     .entity(e.getLocalizedMessage()).build();
//    } catch (RepositoryException e) {
//      return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
//                     .entity(&quot;Could not find license file&quot;).build();
//    } catch (Exception e) {
//      e.printStackTrace();
//    }
    return Response.ok().entity(&quot;Valid License&quot;).build();
}   
</code></pre>

<h5>去除商业提示信息</h5>

<ul>
<li>修改 saiku-server\tomcat\webapps\ROOT\index.html,注掉以下代码</li>
</ul>

<pre><code class="language-html">&lt;!-- 
&lt;script type=&quot;text/x-jquery-tmpl&quot; id=&quot;template-upgrade&quot;&gt;
            &lt;div class=&quot;upgradeheader&quot;&gt;
                You are using Saiku Community Edition, please consider &lt;a target=&quot;_blank&quot; href=&quot;http://saiku.meteorite.bi/support&quot;&gt;purchasing support, or entering a sponsorship agreement with us&lt;/a&gt; to support development. &lt;a href=&quot;mailto:info@meteorite.bi?subject=Supporting Saiku&quot;&gt;info@meteorite.bi&lt;/a&gt;&lt;span class=&quot;close_tab sprite&quot;&gt;&lt;/span&gt;
            &lt;/div&gt;
        &lt;/script&gt;
--&gt;
</code></pre>

<ul>
<li>修改 saiku-server\tomcat\webapps\ROOT\js\saiku\views\Upgrade.js，注掉render中的以下内容</li>
</ul>

<pre><code class="language-javascript">render: function() {
        return this;
/*
        var self = this;
        var license = new License();

        if(Settings.BIPLUGIN5){
                if(Saiku.session.get(&quot;notice&quot;) != undefined &amp;&amp; Saiku.session.get(&quot;notice&quot;)!=null &amp;&amp; Saiku.session.get(&quot;notice&quot;)!=&quot;&quot;){
                    $(this.el).append(&quot;&lt;div&gt;&lt;div id='uphead' class='upgradeheader'&gt;Notice:&quot;+Saiku.session.get(&quot;notice&quot;)+&quot;&lt;/div&gt;&quot;);

                }
                if (Settings.LICENSE.licenseType != undefined &amp;&amp; (Settings.LICENSE.licenseType != &quot;trial&quot; &amp;&amp; Settings.LICENSE.licenseType != &quot;Open Source License&quot;)) {
                    return this;
                }
                if (Settings.LICENSE != undefined &amp;&amp; Settings.LICENSE.licenseType === &quot;trial&quot;) {
                    var yourEpoch = parseFloat(Settings.LICENSE.expiration);
                    var yourDate = new Date(yourEpoch);
                    self.remainingdays = self.daydiff(new Date(), yourDate);


                    $(this.el).append(&quot;&lt;div&gt;&lt;div id='uphead' class='upgradeheader'&gt;You are using a Saiku Enterprise&quot; +
                        &quot; Trial license, you have &quot;+ self.remainingdays+&quot; days remaining. &lt;a href='http://www.meteorite.bi/saiku-pricing'&gt;Buy licenses online.&lt;/a&gt;&lt;/div&gt;&quot;);
                    return self;
                }
                else {
                    $(this.el).append(&quot;&lt;div&gt;&lt;div id='uphead' class='upgradeheader'&gt;You are using Saiku Community&quot; +
                        &quot; Edition, please consider upgrading to &lt;a target='_blank' href='http://meteorite.bi'&gt;Saiku Enterprise&lt;/a&gt;, or entering a &lt;a href='http://meteorite.bi/products/saiku/sponsorship'&gt;sponsorship agreement with us&lt;/a&gt; to support development. &quot; +
                        &quot;&lt;a href='http://meteorite.bi/products/saiku/community'&gt;Or contribute by joining our community and helping other users!&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&quot;);

                    return self;
                }
        }
        else {
                if(Saiku.session.get(&quot;notice&quot;) != undefined &amp;&amp; Saiku.session.get(&quot;notice&quot;)!=null &amp;&amp; Saiku.session.get(&quot;notice&quot;)!=&quot;&quot;){
                    $(this.el).append(&quot;&lt;div&gt;&lt;div id='uphead' class='upgradeheader'&gt;Notice:&quot;+Saiku.session.get(&quot;notice&quot;)+&quot;&lt;/div&gt;&quot;);

                }
                if (Settings.LICENSE.licenseType != undefined &amp;&amp; (Settings.LICENSE.licenseType != &quot;trial&quot; &amp;&amp;
                    Settings.LICENSE.licenseType != &quot;Open Source License&quot;)) {
                    return this;
                }
                if (Settings.LICENSE.licenseType === &quot;trial&quot;) {
                    var yourEpoch = parseFloat(Settings.LICENSE.expiration);
                    var yourDate = new Date(yourEpoch);

                    self.remainingdays = self.daydiff(new Date(), yourDate);

                    $(this.el).append(&quot;&lt;div&gt;&lt;div id='uphead' class='upgradeheader'&gt;You are using a Saiku Enterprise&quot; +
                        &quot; Trial license, you have &quot;+ self.remainingdays+&quot; days remaining. &lt;a href='http://www.meteorite.bi/saiku-pricing'&gt;Buy licenses online.&lt;/a&gt;&lt;/div&gt;&quot;);
                    return self;
                }
                else {
                    $(this.el).append(&quot;&lt;div&gt;&lt;div id='uphead' class='upgradeheader'&gt;You are using Saiku Community&quot; +
                        &quot; Edition, please consider upgrading to &lt;a target='_blank' href='http://meteorite.bi'&gt;Saiku Enterprise&lt;/a&gt;, or entering a &lt;a href='http://meteorite.bi/products/saiku/sponsorship'&gt;sponsorship agreement with us&lt;/a&gt; to support development. &quot; +
                        &quot;&lt;a href='http://meteorite.bi/products/saiku/community'&gt;Or contribute by joining our community and helping other users!&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&quot;);
                    return self;
                }
        }
*/
},
</code></pre>

<h5>去除登录后的欢迎页面</h5>

<p>修改saiku-server\tomcat\webapps\ROOT\js\saiku\views\SplashScreen.js</p>

<pre><code class="language-javascript">template: function() {
        var template = $(&quot;&quot;);
        return _.template(template)({
            //    cube_navigation: Saiku.session.sessionworkspace.cube_navigation
        });

    }
</code></pre>
</article>
                <section class="author">
                    
                    <a class="name" href="/about..html"></a>
                    <div class="intro"></div>
                </section>
                <section class="recommend">
                    
                    
                    <section class="nav next">
                        <div class="head">下篇文章</div>
                        <a class="link" href="/dotnetcore_vue.html">.net core &#43; vue开发单页应用（一）</a>
                    </section>
                    
                </section>
                

            </article>
        </article>
        <footer class="footer">
    <span class="copyright">
        足迹 ©
        <script type="text/javascript">
            document.write(new Date().getFullYear());
        </script>
    </span>
    <span class="publish">Powered by <a href="http://www.chole.io/" target="_blank">Ink</a></span>
</footer>

        <script src="/bundle/index.js"></script>
    </body>
</html>
